#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int	arr[110] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	int sum = arr[0] * (n - 1);
	for (int i = 1; i < n; i++) {
		sum += arr[i];
	}
	cout << sum << endl;
	return 0;
}